import axios from 'axios';
import {ALL_SERVICE_API} from '../api';
var qs = require('qs');
export const createMessage = (params) => {
  return axios.post(ALL_SERVICE_API + '/messages', params);
};

export const updateMessage = (params) => {
  return axios.put(ALL_SERVICE_API + '/messages', params);
};

export const getAllMessages = (params) => {
  return axios.get(ALL_SERVICE_API + '/messages', {params: params});
};

export const getMessage = (id) => {
  return axios.get(ALL_SERVICE_API + '/messages/' + id);
};

export const deleteMessage = (id) => {
  return axios.delete(ALL_SERVICE_API + '/messages/' + id);
};

export const resendMessage = (id, mebPersonalId) => {
  return axios.post(ALL_SERVICE_API + '/messages/resend', qs.stringify({id: id, mebPersonalId: mebPersonalId}));
};

// export const testSendMessage = (messageDTO, phone) => {
//   return axios.post(ALL_SERVICE_API + '/message/testSend', qs.stringify({messageDTO: messageDTO, phone: phone}));
// };

export const testSendMessage = (params, phone) => {
  return axios.post(ALL_SERVICE_API + '/message/testSend/' + phone, params);
};
